﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using Model;
using System.Data;

namespace BLL
{
    public class UserManager
    {
        //登陆操作
        public static int Login(UserInfo userinfo)
        {
            return DAL.UserServer.Login(userinfo);
        }
        //注册操作
        public static object Register(UserInfo userinfo )
        {
            return DAL.UserServer.Register(userinfo);
            
        }
        //公告
        public static object gonggao(Gonggao gonggao)
        {
            return DAL.UserServer.gonggao(gonggao);
        }
        //公文
        public static object gongwen(gongwen gongwen)
        {
            return DAL.UserServer.gongwen(gongwen);
        }
        //职位表添加
        public static object departjob_1( departjob departjob)
        {
            return DAL.UserServer.departjob_1(departjob);
        
        }
        //职位表的查询
        public static object departjob_3(departjob departjob)
        {
            return DAL.UserServer.departjob_3(departjob);
        }
        //职位表假删除
        public static object departjob_delete(UserInfo uf)
        {
            return DAL.UserServer.departjob_2(uf);
        }
        //所有的职位
        public static DataSet departjob_3()
        {
            return DAL.UserServer.departjob_suoyou();
        }
        //签到
        public static object SignIn(SignIn signin)
        {
            return DAL.UserServer.Signln(signin);
        }
        //合同管理添加
        /*public static object Htgl_1(Htgl htgl)
        {
            return DAL.UserServer.Htgl_1(htgl);
        }
        //合同管理查询
        public static object Htgl_3(Htgl htgl)
        {
            return DAL.UserServer.Htgl_3(htgl);

        }*/
        //绩效管理查询
        public static DataSet Jxgl_1(Jxgl jxgl)
        {
            return DAL.UserServer.Jxgl_1(jxgl);
        }
        //绩效管理添加
        public static object Jxgl_2(Jxgl jxgl)
        {
            return DAL.UserServer.Jxgl_2(jxgl);
        }
        //工作日志添加
        public static object worklog_1(worklog log)
        {
            return DAL.UserServer.worklog_1(log);
        }
        //工作日志查询
        public static DataSet worklog_3(worklog log)
        {
            return DAL.UserServer.worklog_3(log);
        }
        //员工表总表
        public static DataSet staff()
        {
            return DAL.UserServer.staff();  
        }
        //员工分表
        public static DataSet staff_1()
        {
            return DAL.UserServer.staff_1();
        }
        //根据ID查询员工信息
        public static Model.UserInfo staff_2(UserInfo userinfo)
        {
            DataSet ds= DAL.UserServer.staff_2(userinfo);
            DataTable table = new DataTable();
            table = ds.Tables[0];
            Model.UserInfo user1 = new Model.UserInfo();
            user1.Uid = (int)table.Rows[0][0];
            user1.Name = table.Rows[0]["员工名字"].ToString();
            user1.Sex = Convert.ToInt32(table.Rows[0]["性别"]);
            user1.Birthday = table.Rows[0]["生日"].ToString();
            user1.Qq =Convert.ToString(table.Rows[0]["QQ号码"]);
            user1.Phone = table.Rows[0]["手机号"].ToString();
            user1.Address = Convert.ToString(table.Rows[0]["地址"]);
            user1.Jobid = Convert.ToInt32(table.Rows[0]["职位ID"]);
            user1.Enable = Convert.ToInt32(table.Rows[0]["是否禁用"]);
           
            return user1;
        }
        //根据ID查询员工信息
        public static DataSet selectUserById(UserInfo userinfo)
        {
            return DAL.UserServer.staff_2(userinfo);
           
        }
        //根据员工名字查询
        public static DataSet staff_id(String key)
        {
            return DAL.UserServer.staff_3(key);
        }
        //删除员工
        public static int staff_delete(UserInfo userinfo)
        {
            return DAL.UserServer.staff_4(userinfo);
        }
        //修改员工部门+职务
        public static int staff_update(UserInfo userinfo)
        {
            return DAL.UserServer.staff_5(userinfo);
        }
        //
        public static DataSet staff_tianjia(UserInfo userinfo)
        {
            return DAL.UserServer.staff_2(userinfo);
        }
        //通过uid查询员工所在职位
        public static String SelectJobByUid(UserInfo uinfo)
        {
            return DAL.UserServer.SelectJobByUid(uinfo);
        }
         //修改用户信息
        public static int updateJobByUid(UserInfo uinfo)
        {
            return DAL.UserServer.updateJobByUid(uinfo);
        }
        //查询员工 编号 职务 薪酬返回 DataTable
        public static DataTable SelectStaffJobDx()
        {
            return DAL.UserServer.SelectAllStaffJobDx().Tables[0];
        }
        //查询单一员工 底薪业绩 提成百分比
        public static DataTable SelectOneStaffJobDx(UserInfo uino)
        {
            return DAL.UserServer.SelectOneStaffJobDx(uino).Tables[0];
        }
        //所有职员
        public static DataSet SelectAllJob()
        {
            return DAL.UserServer.SelectAllJob();
        }
         //底薪修改 
        public static int UpdateDx(int jobbid, int dx)
        {
            return DAL.UserServer.UpdateDx(jobbid,dx);
        }
        
        
    }
}
